package leetcode.code2522;

public class Solution {
	public int minimumPartition(String s, int k) {
		int ans = 1;
		for (int i = 0, num = 0; i < s.length(); i++) {
			int cur = s.charAt(i) - '0';
			if (cur > k) {
				return -1;
			}
			if (1l * num * 10 + cur <= k) {
				num = num * 10 + cur;
			} else {
				ans++;
				num = cur;
			}
		}
		return ans;
	}
}
